const {
  selectRoleInfo,
  selectRoleAllInfo,
  selectRoleInfoById,
  insertRole,
  updataRole,
  deleteRole
} = require('../model/Role');

/* 获取角色信息 */
let getRoles = async (ctx, next) => {
  selectRoleInfo(ctx, next);
};

/* 获取角色信息 */
let getRolesAll = async (ctx, next) => {
  selectRoleAllInfo(ctx, next);
};

/* 根据id获取角色信息 */
let getRole = async (ctx, next) => {
  selectRoleInfoById(ctx, next);
};
/* 保存角色信息 */
let saveRole = async (ctx, next) => {
  insertRole(ctx, next);
};

/* 保存角色信息 */
let putRole = async (ctx, next) => {
  updataRole(ctx, next);
};

/* 保存角色信息 */
let delRole = async (ctx, next) => {
  deleteRole(ctx, next);
};

/* 注意请求方式后面的空格 */
module.exports = {
  'GET /organization/role/conditions': getRoles,
  'GET /organization/role/all': getRolesAll,
  'GET /organization/role/:id': getRole,
  'POST /organization/role': saveRole,
  'PUT /organization/role/:id': putRole,
  'DELETE /organization/role/:id': delRole,
};